Skip to content

Commit d295901

Browse files
committed
first requested changes
1 parent cd8df5b commit d295901

File tree

7 files changed

+13
-109
lines changed

7 files changed

+13
-109
lines changed

integrationTests/ts-esm/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
"typescript-4.2": "npm:[email protected]",
1010
"typescript-4.3": "npm:[email protected]",
1111
"typescript-4.4": "npm:[email protected]",
12-
"typescript-4.5": "npm:[email protected]",
13-
"typescript-next": "npm:typescript@next"
12+
"typescript-4.5": "npm:[email protected]"
1413
}
1514
}

integrationTests/ts/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"typescript-4.2": "npm:[email protected]",
1111
"typescript-4.3": "npm:[email protected]",
1212
"typescript-4.4": "npm:[email protected]",
13-
"typescript-4.5": "npm:[email protected]",
14-
"typescript-next": "npm:typescript@next"
13+
"typescript-4.5": "npm:[email protected]"
1514
}
1615
}

integrationTests/webpack/webpack.config.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
"mode": "production",
33
"entry": "./entry.js",
44
"output": {
5-
"library": {
6-
"type": "commonjs2"
7-
}
5+
"libraryTarget": "commonjs2"
86
}
97
}

package-lock.json

Lines changed: 0 additions & 83 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"prettier:check": "prettier --check .",
4545
"check:spelling": "cspell --cache --no-progress '**/*'",
4646
"check:integrations": "npm run build:npm && npm run build:deno && mocha --full-trace integrationTests/*-test.js",
47-
"build:npm": "node resources/build-npm.js && node resources/build-npm-esm.js",
47+
"build:npm": "node resources/build-npm.js && node resources/build-npm.js --esm-only",
4848
"build:deno": "node resources/build-deno.js",
4949
"gitpublish:npm": "bash ./resources/gitpublish.sh npm npmDist",
5050
"gitpublish:deno": "bash ./resources/gitpublish.sh deno denoDist"
@@ -56,7 +56,6 @@
5656
"@babel/plugin-transform-typescript": "7.15.8",
5757
"@babel/preset-env": "7.15.8",
5858
"@babel/register": "7.15.3",
59-
"@types/babel__core": "^7.1.16",
6059
"@types/chai": "4.2.22",
6160
"@types/mocha": "9.0.0",
6261
"@types/node": "16.11.1",

resources/build-npm-esm.js

Lines changed: 0 additions & 9 deletions
This file was deleted.

resources/build-npm.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,29 +15,31 @@ const prettierConfig = JSON.parse(
1515
fs.readFileSync(require.resolve('../.prettierrc'), 'utf-8'),
1616
);
1717

18+
const isESMOnly = process.argv.includes('--esm-only');
19+
1820
if (require.main === module) {
1921
buildNPM();
2022
}
2123

2224
exports.buildNPM = buildNPM;
2325

24-
function buildNPM({ isFullESM = false } = {}) {
25-
const distDirectory = isFullESM ? './npmEsmDist' : './npmDist';
26+
function buildNPM() {
27+
const distDirectory = isESMOnly ? './npmEsmDist' : './npmDist';
2628

2729
fs.rmSync(distDirectory, { recursive: true, force: true });
2830
fs.mkdirSync(distDirectory);
2931

3032
const srcFiles = readdirRecursive('./src', { ignoreDir: /^__.*__$/ });
3133

32-
const packageJSON = buildPackageJSON(srcFiles, { isFullESM });
34+
const packageJSON = buildPackageJSON(srcFiles);
3335

3436
for (const filepath of srcFiles) {
3537
const srcPath = path.join('./src', filepath);
3638
const destPath = path.join(distDirectory, filepath);
3739

3840
fs.mkdirSync(path.dirname(destPath), { recursive: true });
3941
if (filepath.endsWith('.ts')) {
40-
if (isFullESM) {
42+
if (isESMOnly) {
4143
const js =
4244
filepath === 'version.ts'
4345
? babelTransform(getVersionFileBody(packageJSON.version), {
@@ -85,7 +87,7 @@ function buildNPM({ isFullESM = false } = {}) {
8587

8688
assert(packageJSON.types === undefined, 'Unexpected "types" in package.json');
8789

88-
if (isFullESM) {
90+
if (isESMOnly) {
8991
packageJSON.typesVersions = {
9092
'>=4.2.0': {
9193
'*': ['*'],
@@ -150,7 +152,6 @@ function buildPackageJSON(
150152
* @type {string[]}
151153
*/
152154
srcFiles,
153-
{ isFullESM = false } = {},
154155
) {
155156
/**
156157
* @type {Record<string,unknown>}
@@ -163,7 +164,7 @@ function buildPackageJSON(
163164
delete packageJSON.scripts;
164165
delete packageJSON.devDependencies;
165166

166-
if (isFullESM) {
167+
if (isESMOnly) {
167168
delete packageJSON.module;
168169
packageJSON.version = `${packageJSON.version}-esm`;
169170

@@ -199,7 +200,7 @@ function buildPackageJSON(
199200
packageJSON.publishConfig = { tag: publishTag };
200201
}
201202

202-
if (isFullESM) {
203+
if (isESMOnly) {
203204
/**
204205
* This allows imports without explicit extensions and index imports
205206
* Like `import("graphql/language/parser")` and `import("graphql/utilities")`

0 commit comments

Comments
 (0)