Skip to content

Commit

Permalink
new dep copy
Browse files Browse the repository at this point in the history
  • Loading branch information
jakub-bao committed Feb 8, 2024
1 parent d39796a commit ac32dbe
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 5 deletions.
2 changes: 1 addition & 1 deletion datim-api/build/commonjs/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion datim-api/build/es6js/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion datimuser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.7",
"description": "Service to determine DHIS2 user type from raw user object",
"main": "index.ts",
"exports": "./build/index.js",
"exports": "./index.ts",
"scripts": {
"test": "jest --watch",
"typecheck": "tsc --noEmit index.ts"
Expand Down
2 changes: 1 addition & 1 deletion dhis2-loader/jsbuild/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions local-import/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
build
25 changes: 25 additions & 0 deletions local-import/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import cpy from 'cpy'
import {readFileSync} from "node:fs";

const modulePath = process.argv[2]

type Map = {
[key:string]:string
}

type PackageJson = {
name: string;
devDependencies: Map
peerDependecies: Map
}

const packageJson:PackageJson = JSON.parse(readFileSync(`${modulePath}/package.json`).toString())
const [namespace, name] = packageJson.name.split('/')
const peerAndDevDependencies:string[] = [...Object.keys(packageJson.devDependencies||[]), ...Object.keys(packageJson.peerDependecies||[])]

console.log(`Copying files from ${modulePath} to ./node_modules/${namespace}/${name}`)

cpy(`${modulePath}/**/*`,`./node_modules/${namespace}/${name}`,{
filter: file => !peerAndDevDependencies.some(dependencyName=>file.relativePath.includes(`node_modules/${dependencyName}/`))
})

22 changes: 22 additions & 0 deletions local-import/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "@pepfar-react-lib/local-import",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "rm -rf node_modules/@app && tsc && node build/index.js ./test/project"
},
"repository": {
"type": "git",
"url": "https://github.com/pepfar-datim/javascript-libraries.git"
},
"private": true,
"devDependencies": {
"@types/node": "^20.11.16",
"typescript": "^5.3.3"
},
"dependencies": {
"cpy": "^11.0.0"
},
"type": "module"
}
7 changes: 7 additions & 0 deletions local-import/test/project/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "@app/module1",
"devDependencies": {
"react": "1",
"@vite/vitejs": "1"
}
}
12 changes: 12 additions & 0 deletions local-import/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "NodeNext",
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": false,
"skipLibCheck": true,
"types": ["node"],
"outDir": "build"
}
}
2 changes: 1 addition & 1 deletion testwrap/jsbuild/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ac32dbe

Please sign in to comment.