Skip to content

Commit

Permalink
Support "module" field (textlint#690)
Browse files Browse the repository at this point in the history
* feat(kernel): "module" support

* feat: support "module" field

* chore: add file

* chore: fix ,

* chore: add bin to files

* chore: ignore module
  • Loading branch information
azu authored Jul 24, 2020
1 parent 3cf0b4a commit 9ea4b33
Show file tree
Hide file tree
Showing 63 changed files with 596 additions and 182 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ crashlytics-build.properties
/.eslintcache
# lerna
packages/*/lib/
packages/*/module/
packages/@textlint/*/lib/
packages/@textlint/*/module/

packages/**/yarn.lock
test/**/yarn.lock

Expand All @@ -97,3 +100,4 @@ website/i18n/*
!website/i18n/en.json
# TypeScript
tsconfig.tsbuildinfo
tsconfig.*.tsbuildinfo
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
out/
lib/
module/
node_modules/
8 changes: 7 additions & 1 deletion examples/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
"devDependencies": {
"textlint": "^11.6.3",
"textlint-rule-no-todo": "^2.0.1"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/config-file/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
"devDependencies": {
"textlint": "^11.6.3",
"textlint-rule-no-todo": "^2.0.1"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/config-in-package-json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,11 @@
"rules": {
"no-todo": true
}
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/filter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
"textlint": "^11.6.3",
"textlint-filter-rule-comments": "^1.2.2",
"textlint-rule-no-todo": "^2.0.1"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/fix-dry-run/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
"devDependencies": {
"textlint": "^11.6.3",
"textlint-rule-prh": "^5.2.0"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/fix/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,11 @@
"devDependencies": {
"textlint": "^11.6.3",
"textlint-rule-prh": "^5.2.0"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/html-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@
"textlint": "^11.6.3",
"textlint-plugin-html": "^0.2.0",
"textlint-rule-sentence-length": "^2.1.2"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/perf/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@
"textlint-rule-no-start-duplicated-conjunction": "^2.0.2",
"textlint-rule-prh": "^5.2.0",
"textlint-rule-spellcheck-tech-word": "^5.0.0"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/plugin-extensions-option/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@
"expected-exit-status": "^1.0.2",
"textlint": "^11.6.3",
"textlint-rule-no-todo": "^2.0.1"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/preset/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
"devDependencies": {
"textlint": "^11.6.3",
"textlint-rule-preset-jtf-style": "^2.3.2"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/rulesdir/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,11 @@
},
"devDependencies": {
"textlint": "^11.6.3"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/use-as-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@
"dependencies": {
"textlint": "^11.6.3",
"textlint-rule-no-todo": "^2.0.1"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
8 changes: 7 additions & 1 deletion examples/use-as-ts-module/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,11 @@
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.2",
"typescript": "~3.8.3"
}
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
]
}
17 changes: 10 additions & 7 deletions packages/@textlint/ast-node-types/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@
"keywords": [
"textlint"
],
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"license": "MIT",
"author": "azu",
"main": "./lib/index.js",
"module": "./module/index.js",
"types": "./lib/index.d.ts",
"files": [
"bin/",
"lib/",
"modules/",
"src/"
],
"main": "./lib/index.js",
"types": "./lib/index.d.ts",
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"scripts": {
"build": "tsc -b",
"build": "tsc -b && tsc -b tsconfig.module.json",
"clean": "rimraf lib/ tsconfig.tsbuildinfo",
"prepublish": "npm run build",
"test": "mocha \"test/**/*.{js,ts}\""
Expand Down
7 changes: 7 additions & 0 deletions packages/@textlint/ast-node-types/tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./module/",
}
}
13 changes: 8 additions & 5 deletions packages/@textlint/ast-tester/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,20 @@
},
"license": "MIT",
"author": "azu",
"files": [
"src/",
"lib/"
],
"main": "lib/index.js",
"module": "./module/index.js",
"types": "lib/index.d.ts",
"directories": {
"test": "test"
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
],
"scripts": {
"build": "tsc -b",
"build": "tsc -b && tsc -b tsconfig.module.json",
"clean": "rimraf lib/ tsconfig.tsbuildinfo",
"prepublish": "npm run --if-present build",
"test": "mocha \"test/**/*.{js,ts}\"",
Expand Down
7 changes: 7 additions & 0 deletions packages/@textlint/ast-tester/tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./module/"
}
}
20 changes: 12 additions & 8 deletions packages/@textlint/ast-traverse/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@
"bugs": {
"url": "https://github.com/textlint/textlint/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"license": "MIT",
"author": "azu",
"files": [
"lib"
],
"main": "./lib/index.js",
"module": "./module/index.js",
"types": "./lib/index.d.ts",
"directories": {
"test": "test/"
},
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
],
"scripts": {
"build": "tsc -b",
"build": "tsc -b && tsc -b tsconfig.module.json",
"clean": "rimraf lib/ tsconfig.tsbuildinfo",
"prepublish": "npm run --if-present build",
"test": "mocha \"test/**/*.ts\"",
Expand Down
7 changes: 7 additions & 0 deletions packages/@textlint/ast-traverse/tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./module/"
}
}
22 changes: 12 additions & 10 deletions packages/@textlint/feature-flag/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@
"bugs": {
"url": "https://github.com/textlint/textlint/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"license": "MIT",
"author": "azu",
"type": "lib/index.d.ts",
"main": "lib/index.js",
"module": "./module/index.js",
"directories": {
"test": "test"
},
"files": [
"bin/",
"lib/",
"modules/",
"src/"
],
"main": "lib/index.js",
"type": "lib/index.d.ts",
"directories": {
"test": "test"
},
"repository": {
"type": "git",
"url": "https://github.com/textlint/textlint.git"
},
"scripts": {
"build": "tsc -b",
"build": "tsc -b && tsc -b tsconfig.module.json",
"clean": "rimraf lib/ tsconfig.tsbuildinfo",
"prepublish": "npm run --if-present build",
"test": "mocha \"test/**/*.ts\"",
Expand Down
2 changes: 1 addition & 1 deletion packages/@textlint/feature-flag/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const isFeatureEnabled = (flagName: string, { loose = false } = {}): bool

// == CORE Flags
// if run textlint --experimental, set experimental true by default
if (process && Array.isArray(process.argv) && process.argv.indexOf("--experimental") !== -1) {
if (typeof process !== "undefined" && Array.isArray(process.argv) && process.argv.indexOf("--experimental") !== -1) {
setFeature("core.experimental", true);
}
/**
Expand Down
7 changes: 7 additions & 0 deletions packages/@textlint/feature-flag/tsconfig.module.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "ESNext",
"outDir": "./module/",
}
}
19 changes: 11 additions & 8 deletions packages/@textlint/fixer-formatter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@
"bugs": {
"url": "https://github.com/textlint/textlint/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/textlint/textlint.git"
},
"license": "MIT",
"author": "azu",
"main": "lib/index.js",
"module": "./module/index.js",
"types": "lib/index.d.ts",
"files": [
"lib/fixer-formatter",
"bin/",
"lib/",
"modules/",
"src/"
],
"main": "lib/index.js",
"types": "lib/index.d.ts",
"repository": {
"type": "git",
"url": "git+https://github.com/textlint/textlint.git"
},
"scripts": {
"build": "tsc -b",
"build": "tsc -b && tsc -b tsconfig.module.json",
"clean": "rimraf lib/ tsconfig.tsbuildinfo",
"prepublish": "npm run build",
"test": "mocha \"test/**/*.{js,ts}\""
Expand Down
Loading

0 comments on commit 9ea4b33

Please sign in to comment.