diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 1c3f3982..00000000 --- a/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -*.tsbuildinfo -tsconfig-build.json -**/dist/**/__tests__ -**/dist/**/*.test.d.ts -utils/**/*.d.ts diff --git a/build-settings/remove-files-not-to-be-packaged.ts b/build-settings/remove-files-not-to-be-packaged.ts deleted file mode 100755 index 7c45a801..00000000 --- a/build-settings/remove-files-not-to-be-packaged.ts +++ /dev/null @@ -1,39 +0,0 @@ -#!/usr/bin/env -S node -r @swc-node/register -import * as fs from "fs"; -import * as path from "path"; -import * as fglob from "fast-glob"; -import ignore from "ignore"; - -const rootDir = path.join(__dirname, ".."); -const gitIgnorePath = path.join(rootDir, ".gitignore"); -const npmIgnorePath = path.join(rootDir, ".npmignore"); - -// Now we loop each line of npmIgnore and delete the files that match. -// NOTE: We really want to exclude everything listed in the .npmignore file -// but that might include source-controlled files. So, we also check -// the .gitignore file to see if it's matched there as well before we delete -// anything. Ideally, changeset publish will honour the .npmignore file -// and not include those files in the package - if that starts happening, -// we can probably just remove this script. -const npmIgnoreContent = fs.readFileSync(npmIgnorePath, "utf-8"); -const npmIgnorer = ignore().add(npmIgnoreContent); -const gitIgnoreContent = fs.readFileSync(gitIgnorePath, "utf-8"); -const gitIgnorer = ignore().add(gitIgnoreContent); - -const packagePaths = fglob.sync("packages/wonder-stuff-*/**/*", { - cwd: rootDir, - onlyFiles: false, -}); - -for (const fsPath of packagePaths) { - const absPath = path.join(rootDir, fsPath); - if ( - fs.existsSync(fsPath) && - npmIgnorer.ignores(fsPath) && - gitIgnorer.ignores(fsPath) - ) { - // eslint-disable-next-line no-console - console.log(`Removing ${fsPath}`); - fs.rmSync(absPath, {recursive: true}); - } -} diff --git a/npm-ignore-definition b/npm-ignore-definition new file mode 100644 index 00000000..76efdc8a --- /dev/null +++ b/npm-ignore-definition @@ -0,0 +1,4 @@ +*.tsbuildinfo +tsconfig-build.json +dist/**/__tests__ +dist/**/*.test.d.ts diff --git a/package.json b/package.json index 2e3bb875..07a5963e 100644 --- a/package.json +++ b/package.json @@ -83,7 +83,7 @@ "rollup": "rollup -c build-settings/rollup.config.mjs", "build": "yarn rollup", "build:prodsizecheck": "yarn rollup --configPlatforms='browser' --configFormats='esm' --configEnvironment='production'", - "build:types": "yarn tsc --build --verbose tsconfig-build.json && ./build-settings/remove-files-not-to-be-packaged.ts && ./build-settings/check-type-definitions.ts", + "build:types": "yarn tsc --build --verbose tsconfig-build.json && ./build-settings/check-type-definitions.ts", "build:docs": "typedoc", "watch": "yarn rollup --watch", "clean": "rm -rf packages/wonder-stuff-*/dist && rm -rf packages/wonder-stuff-*/node_modules && rm -f packages/*/*.tsbuildinfo", diff --git a/packages/eslint-config-khan/.npmignore b/packages/eslint-config-khan/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/eslint-config-khan/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/eslint-plugin-khan/.npmignore b/packages/eslint-plugin-khan/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/eslint-plugin-khan/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-ci/.npmignore b/packages/wonder-stuff-ci/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-ci/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-core/.npmignore b/packages/wonder-stuff-core/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-core/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-i18n/.npmignore b/packages/wonder-stuff-i18n/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-i18n/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-render-environment-jsdom/.npmignore b/packages/wonder-stuff-render-environment-jsdom/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-render-environment-jsdom/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-render-server/.npmignore b/packages/wonder-stuff-render-server/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-render-server/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-sentry/.npmignore b/packages/wonder-stuff-sentry/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-sentry/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-server/.npmignore b/packages/wonder-stuff-server/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-server/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/packages/wonder-stuff-testing/.npmignore b/packages/wonder-stuff-testing/.npmignore new file mode 120000 index 00000000..2720def8 --- /dev/null +++ b/packages/wonder-stuff-testing/.npmignore @@ -0,0 +1 @@ +/Users/jeffyates/khan/wonder-stuff/npm-ignore-definition \ No newline at end of file diff --git a/utils/create-npmignore-symlinks.sh b/utils/create-npmignore-symlinks.sh new file mode 100755 index 00000000..b41d9150 --- /dev/null +++ b/utils/create-npmignore-symlinks.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# Path to the npm-ignore-definition file +IGNORE_FILE="npm-ignore-definition" + +# Loop through each directory under the packages directory +for dir in packages/*; do + if [ -d "$dir" ]; then + if [ ! -L "$dir/.npmignore" ]; then + ln -s "$(pwd)/$IGNORE_FILE" "$dir/.npmignore" + echo "Created symlink in $dir" + else + echo "Symlink already exists in $dir" + fi + fi +done \ No newline at end of file