Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convhand 222 detect node version on install and prevent install with old versions #13

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions figma-exporter/src/transformers/scss/components/button.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ export const transformButtonComponentTokensToScssVariables = (tokens: ButtonComp
[getScssVariableName({ component: 'button', part: '', property: 'opacity', theme, type, state })]: {
value: `${tokens.opacity}`,
property: 'opacity',
group: Part.Button,
},
};
};
28 changes: 23 additions & 5 deletions installer/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,26 @@ const maskPrompt = (query) =>
*/
(async () => {
try {
let requirements = false;
const result = process.versions;
if (result && result.node) {
if (parseInt(result.node) >= 16) {
requirements = true;
}
} else {
// couldn't find the right version, but ...
}
if (!requirements) {
console.log(chalk.redBright('Handoff Installation failed'));
console.log(chalk.yellow('- Please update node to at least Node 16 https://nodejs.org/en/download. \n- You can read more about installing handoff at https://www.handoff.com/docs/'));
process.exit(0);
}
// Get a folder name
const welcome = `The Handoff App installer will ask a couple of questions to set up the project.
Only the project name is required. The rest can be supplied via a .env file or env vars.\n`;
const welcome = `\n==============================\nThe Handoff App installer will ask a couple of questions to set up the project.
Only the project name is required. The rest can be supplied via a .env file or env vars.\n==============================\n`;
console.log(welcome);
// Ask the user for a project name
const project = await prompt('Project name: (lower case, no spaces) ');
const project = await prompt(chalk.green('Project name: (lower case, no spaces) '));
if (project === '') {
// You've got to give us a project name
console.log('Sorry, Project name is required.');
Expand All @@ -54,9 +68,12 @@ Only the project name is required. The rest can be supplied via a .env file or e
}

// Fetch figma file id
const figmaIdSupplied = await prompt('Figma File Id (optional): ');
console.log(`\n==============================\nNext we need the Figma file id. You can find this by looking at the url of your Figma file. \nIf the url is ${chalk.blue(`https://www.figma.com/file/IGYfyraLDa0BpVXkxHY2tE/Starter-%5BV2%5D`)}\nyour id would be IGYfyraLDa0BpVXkxHY2tE\n==============================\n`)
const figmaIdSupplied = await prompt(chalk.green('Figma File Id (optional): '));
// Fetch a masked developer key
const developerKeySupplied = await maskPrompt('Figma Developer Key (optional): ');
console.log(`\n==============================\nFinally we need a developer token so we can access Figma on your behalf. \n Use these instructions to generate them ${chalk.blue(`https://help.figma.com/hc/en-us/articles/8085703771159-Manage-personal-access-tokens`)} \n==============================\n`)

const developerKeySupplied = await maskPrompt(chalk.green('Figma Developer Key (optional): '));

// Get the current directory
const currentDir = process.cwd();
Expand Down Expand Up @@ -94,6 +111,7 @@ Only the project name is required. The rest can be supplied via a .env file or e
rl.close();
} catch (e) {
console.error(chalk.red('Installation Failed'), e);
process.exit(0);
}
})();

Expand Down