diff --git a/package.json b/package.json index 1875bb095..b91750a11 100644 --- a/package.json +++ b/package.json @@ -28,4 +28,4 @@ "@openfn/simple-ast": "0.4.1", "eslint": "8.26.0" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fe50f4892..381fecd1c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -626,6 +626,34 @@ importers: specifier: 3.0.2 version: 3.0.2 + packages/hello: + dependencies: + '@openfn/language-common': + specifier: workspace:* + version: link:../common + devDependencies: + assertion-error: + specifier: 2.0.0 + version: 2.0.0 + chai: + specifier: 4.3.6 + version: 4.3.6 + deep-eql: + specifier: 4.1.1 + version: 4.1.1 + esno: + specifier: ^0.16.3 + version: 0.16.3 + mocha: + specifier: 9.2.2 + version: 9.2.2 + rimraf: + specifier: 3.0.2 + version: 3.0.2 + undici: + specifier: ^5.22.1 + version: 5.23.0 + packages/hive: dependencies: '@openfn/language-common': @@ -1932,40 +1960,6 @@ importers: specifier: ^1.12.0 version: 1.12.0 - packages/template: - dependencies: - '@openfn/language-common': - specifier: ^1.12.0 - version: link:../common - devDependencies: - '@openfn/buildtools': - specifier: workspace:^1.0.2 - version: link:../../tools/build - '@openfn/simple-ast': - specifier: 0.4.1 - version: 0.4.1 - assertion-error: - specifier: 2.0.0 - version: 2.0.0 - chai: - specifier: 4.3.6 - version: 4.3.6 - deep-eql: - specifier: 4.1.1 - version: 4.1.1 - esno: - specifier: ^0.16.3 - version: 0.16.3 - mocha: - specifier: 9.2.2 - version: 9.2.2 - rimraf: - specifier: 3.0.2 - version: 3.0.2 - undici: - specifier: ^5.22.1 - version: 5.22.1 - packages/twilio: dependencies: '@openfn/language-common': @@ -2146,40 +2140,6 @@ importers: specifier: 17.6.0 version: 17.6.0 - tools/generate/template: - dependencies: - '@openfn/language-common': - specifier: ^1.12.0 - version: link:../../../packages/common - devDependencies: - '@openfn/buildtools': - specifier: workspace:^1.0.2 - version: link:../../build - '@openfn/simple-ast': - specifier: 0.4.1 - version: 0.4.1 - assertion-error: - specifier: 2.0.0 - version: 2.0.0 - chai: - specifier: 4.3.6 - version: 4.3.6 - deep-eql: - specifier: 4.1.1 - version: 4.1.1 - esno: - specifier: ^0.16.3 - version: 0.16.3 - mocha: - specifier: 9.2.2 - version: 9.2.2 - rimraf: - specifier: 3.0.2 - version: 3.0.2 - undici: - specifier: ^5.22.1 - version: 5.23.0 - tools/import-tests: dependencies: '@openfn/language-common': @@ -5260,10 +5220,10 @@ packages: engines: {node: '>=4'} dependencies: assertion-error: 1.1.0 - check-error: 1.0.2 + check-error: 1.0.3 deep-eql: 3.0.1 - get-func-name: 2.0.0 - loupe: 2.3.6 + get-func-name: 2.0.2 + loupe: 2.3.7 pathval: 1.1.1 type-detect: 4.0.8 dev: true diff --git a/tools/generate/src/generate-adaptor.ts b/tools/generate/src/generate-adaptor.ts index e02a8810a..d2372eb18 100644 --- a/tools/generate/src/generate-adaptor.ts +++ b/tools/generate/src/generate-adaptor.ts @@ -23,10 +23,13 @@ const generateAdaptor = async (adaptorName: string) => { await copyAndRename(templatePath, adaptorPath, adaptorName); console.log(`Adaptor "${adaptorName}" created successfully.`); console.log( - `Reminder: Please change the assets 🖼️ for your new adaptor "${adaptorName}".` + `Reminder: Change the assets 🖼️ for your new adaptor "${adaptorName}".` ); + console.log(`Reminder: Run "pnpm install" to install your packages.`); }; +const fileMap = { package_json: 'package.json' }; + const copyAndRename = async ( source: string, target: string, @@ -39,7 +42,7 @@ const copyAndRename = async ( const targetPath = path.join( target, - item.name.replace('template', adaptorName) + fileMap[item.name] ?? item.name.replace('template', adaptorName) ); if (item.isDirectory()) { @@ -48,6 +51,7 @@ const copyAndRename = async ( } else if (item.isFile()) { let content = await fs.readFile(sourcePath, 'utf8'); content = content.replace(/{{TEMPLATE}}/g, adaptorName); + await fs.writeFile(targetPath, content); } } diff --git a/tools/generate/template/package.json b/tools/generate/template/package_json similarity index 100% rename from tools/generate/template/package.json rename to tools/generate/template/package_json