Skip to content
This repository was archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Misc items
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesrp13 committed Dec 18, 2023
1 parent de00ec7 commit acc43db
Show file tree
Hide file tree
Showing 7 changed files with 115 additions and 178 deletions.
6 changes: 0 additions & 6 deletions ejs/ejs_data.json

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"dist"
],
"scripts": {
"dev-ejs": "node ejs/ejs_script.js",
"template-dev": "node scripts/template_dev/ejs_dev_script.js",
"dev": "yarn clean && tsc-watch --onSuccess \"yarn build-dev\"",
"build-dev": "yarn clean && tsc && tsc-alias && copyfiles \"compiled/*/+(LICENSE|package.json)\" dist",
"build": "yarn clean && tsc && tsc-alias && copyfiles \"compiled/*/+(LICENSE|package.json)\" dist && ./scripts/minify.ts",
Expand Down
8 changes: 8 additions & 0 deletions scaffolds/dev-data.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export const templateDevData = {
'nextjs-dedicated-wallet': {
network: 'ethereum-goerli',
publishableApiKey: 'pk_live_8D6C562ABCA3140A',
loginMethods: ['EmailOTP', 'SMSOTP'],
projectName: 'ejs-test-project',
},
};
11 changes: 6 additions & 5 deletions ejs/ejs_script.js → scripts/template_dev/ejs_dev_script.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ let fs = require('fs-extra');
const { setupTsconfig, convertCommandToString } = require('./utils');

setupTsconfig();
const { templateDevData } = require('../../scaffolds/dev-data');

let nextProcess = null;

const template = process.argv[2];

const EJS_DATA_FILE = '../ejs/ejs_data.json';
// const EJS_DATA_FILE = '../ejs/ejs_data.json';
const ejsData = templateDevData[template];
const ejsSourceFiles = [
{ inputFile: './package.json', outputFile: './package.json' },
{ inputFile: './.env.example', outputFile: './.env' },
Expand All @@ -19,7 +21,8 @@ const ejsSourceFiles = [
outputFile: './src/components/magic/cards/WalletMethodsCard.tsx',
},
];
const scaffoldInstance = new (require(`../scaffolds/${template}/scaffold.ts`).default)();
console.log(process.cwd());
const scaffoldInstance = new (require(`../../scaffolds/${template}/scaffold.ts`).default)();

console.log('Rebuilding template...');
fs.rmSync('./test', { recursive: true, force: true });
Expand All @@ -29,14 +32,12 @@ fs.cpSync(`./scaffolds/${template}/template`, './test', { recursive: true });
process.chdir('./test');

if (!fs.existsSync('./node_modules')) {
console.log('Current directory: ', process.cwd());

console.log('Installing dependencies...');
execSync(convertCommandToString(scaffoldInstance.installationCommand), { stdio: 'inherit' });
}

ejsSourceFiles.forEach(({ inputFile, outputFile }) => {
const result = execSync(`ejs ${inputFile} -f ${EJS_DATA_FILE} -o ${outputFile}`);
const result = execSync(`ejs ${inputFile} -i '${JSON.stringify(ejsData)}' -o ${outputFile}`);
console.log('Template compiled:', inputFile);
});

Expand Down
2 changes: 1 addition & 1 deletion ejs/utils.js → scripts/template_dev/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const tsNode = require('ts-node');
let json = require('json5');
let fs = require('fs-extra');

//setting up tsconfig for ts-node to compilt the scaffold.ts file of any scaffold
//setting up tsconfig for ts-node to compile the scaffold.ts file of any scaffold
const setupTsconfig = () => {
let tsconfig = {
compilerOptions: {
Expand Down
Loading

0 comments on commit acc43db

Please sign in to comment.