Skip to content

Commit

Permalink
Add "type" field to package.json files
Browse files Browse the repository at this point in the history
  • Loading branch information
1aron committed Feb 26, 2024
1 parent fc1a000 commit 6b1641f
Show file tree
Hide file tree
Showing 18 changed files with 3,536 additions and 406 deletions.
1 change: 1 addition & 0 deletions packages/class-variant/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "class-variant",
"type": "module",
"scripts": {
"build": "techor build",
"dev": "pnpm build --watch",
Expand Down
3 changes: 2 additions & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@master/css-cli",
"scripts": {
"build": "techor build",
"build": "techor build \"src/**/*.ts\" --formats esm",
"dev": "pnpm build --watch",
"lint": "eslint ./src",
"type-check": "tsc --noEmit",
Expand Down Expand Up @@ -45,6 +45,7 @@
"@techor/fs": "^3.0.14",
"@techor/glob": "^3.0.14",
"@techor/log": "^3.0.14",
"bytes": "^3.1.2",
"chokidar": "^3.6.0",
"commander": "^12.0.0",
"explore-config": "^3.0.14",
Expand Down
24 changes: 2 additions & 22 deletions packages/cli/src/bin/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,5 @@
#!/usr/bin/env node
import { resolve } from 'node:path'
import { Command } from 'commander'
import { readJSONFileSync } from '@techor/fs'
import { dirname } from 'path'
import { fileURLToPath } from 'url'

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
import runProgram from '../core'

const pkg = readJSONFileSync(resolve(__dirname, '../../package.json'))
const program = new Command()

program
.name(pkg.name)
.description(pkg.description)
.version(pkg.version || '0.0.0')

import commandExtract from '../commands/extract'
import commandRender from '../commands/render'

commandExtract(program)
commandRender(program)

program.parse()
runProgram()
23 changes: 23 additions & 0 deletions packages/cli/src/core.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { resolve } from 'node:path'
import { Command } from 'commander'
import { readJSONFileSync } from '@techor/fs'
import { dirname } from 'path'
import { fileURLToPath } from 'url'
import commandExtract from './commands/extract'
import commandRender from './commands/render'
const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)

const pkg = readJSONFileSync(resolve(__dirname, '../package.json'))

export default function runProgram(argv: string[] = process.argv) {
const program = new Command()
program
.name(pkg.name)
.description(pkg.description)
.version(pkg.version || '0.0.0')
commandExtract(program)
commandRender(program)
program.parse(argv)
return program
}
3 changes: 2 additions & 1 deletion packages/cli/tests/extract/test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { execSync } from 'child_process'
import { execaCommandSync } from 'execa'
import fs, { readFileSync } from 'fs'
import { join } from 'path'
Expand All @@ -11,6 +12,6 @@ it('basic extract', async () => {
}
}
`, { flag: 'w' })
execaCommandSync('tsx ../../src/bin extract', { cwd: __dirname })
execSync('tsx ../../src/bin extract', { cwd: __dirname })
expect(readFileSync(join(__dirname, '.virtual/master.css')).toString()).toMatch(/(fg\\:primary|m\\:12x|text\\:center|font\\:sans|font\\:heavy|font\\:48)/)
})
4 changes: 4 additions & 0 deletions packages/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@
"src/**/*.ts",
"tests/**/*.test.ts",
"tests/**/test.ts"
],
"exclude": [
"node_modules",
"dist"
]
}
1 change: 1 addition & 0 deletions packages/eslint-plugin/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/eslint-plugin-css",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.ts\"",
"dev": "pnpm build --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/extractor.webpack/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css-extractor.webpack",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.ts\"",
"dev": "pnpm build --watch",
Expand Down
2 changes: 1 addition & 1 deletion packages/extractor/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "@master/css-extractor",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.ts\"",
"dev": "techor build --watch",
"lint": "eslint ./src",
"type-check": "tsc --noEmit",
"test": "jest"
},
"type": "module",
"license": "MIT",
"description": "Master CSS static extractor for various raw text",
"author": "Aoyue Design LLC.",
Expand Down
2 changes: 1 addition & 1 deletion packages/nuxt/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css.nuxt",
"type": "module",
"scripts": {
"build": "nuxt-module-build prepare && nuxt-module-build",
"dev": "nuxt-module-build prepare && nuxi dev playground",
Expand All @@ -8,7 +9,6 @@
"lint": "eslint .",
"test": "vitest run"
},
"type": "module",
"license": "MIT",
"description": "Integrate Master CSS Progressive Rendering in Nuxt way",
"author": "Aoyue Design LLC.",
Expand Down
1 change: 1 addition & 0 deletions packages/react/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css.react",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.tsx\"",
"dev": "pnpm build --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css-server",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.ts\"",
"dev": "pnpm build --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/theme-service/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "theme-service",
"type": "module",
"scripts": {
"build": "techor build",
"dev": "pnpm build --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/validator/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css-validator",
"type": "module",
"scripts": {
"build": "techor build \"src/**/*.ts\"",
"dev": "pnpm build --watch",
Expand Down
1 change: 1 addition & 0 deletions packages/vue/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@master/css.vue",
"type": "module",
"scripts": {
"build:main": "vite build",
"build:type": "vue-tsc --declaration --emitDeclarationOnly",
Expand Down
Loading

0 comments on commit 6b1641f

Please sign in to comment.