|
@@ -1,22 +1,22 @@
|
|
|
-const theme = process.argv[ 2 ];
|
|
|
+const theme = process.argv[2];
|
|
|
|
|
|
-if ( ! theme ) {
|
|
|
- console.error( '\x1b[41m', 'You must specify a theme!' );
|
|
|
+if (!theme) {
|
|
|
+ console.error('\x1b[41m', 'You must specify a theme!');
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
-const { Octokit } = require( 'octokit' );
|
|
|
-const octokit = new Octokit( { auth: `PUT YOUR TOKEN HERE` } );
|
|
|
+const { Octokit } = require('octokit');
|
|
|
+const octokit = new Octokit({ auth: `PUT YOUR TOKEN HERE` });
|
|
|
|
|
|
async function createLabel() {
|
|
|
try {
|
|
|
- return await octokit.request( 'POST /repos/Automattic/themes/labels', {
|
|
|
+ return await octokit.request('POST /repos/Automattic/themes/labels', {
|
|
|
name: '[Theme] ' + theme,
|
|
|
color: 'c1f4a1',
|
|
|
description: 'Automatically generated label for ' + theme + '.',
|
|
|
- } );
|
|
|
- } catch ( error ) {
|
|
|
- console.log( error );
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -30,69 +30,69 @@ async function createMilestone() {
|
|
|
'Automatically generated milestone for ' + theme + '.',
|
|
|
}
|
|
|
);
|
|
|
- } catch ( error ) {
|
|
|
- console.error( '\x1b[41m', 'Milestone already created.' );
|
|
|
+ } catch (error) {
|
|
|
+ console.error('\x1b[41m', 'Milestone already created.');
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-async function createIssues( milestoneNumber ) {
|
|
|
+async function createIssues(milestoneNumber) {
|
|
|
const issues = [
|
|
|
- 'Create base theme from boilerplate',
|
|
|
+ 'Create base theme',
|
|
|
'Create a demo site on dotcom',
|
|
|
'theme.json: Typography settings',
|
|
|
'theme.json: Color palette',
|
|
|
- 'theme.json: Alternative color palettes',
|
|
|
'theme.json: Margin/spacing settings + content layout',
|
|
|
'Templates: Page templates - Index',
|
|
|
'Templates: Page templates - Search',
|
|
|
'Templates: Page templates - 404',
|
|
|
'Templates: Page templates - Archive',
|
|
|
- 'Templates: Header template part (including mobile)',
|
|
|
- 'Templates: Footer template part (including mobile)',
|
|
|
- 'Block patterns (if needed)',
|
|
|
- 'Comment form styles (dotcom and dotorg) (if needed)',
|
|
|
- 'Navigation (if needed)',
|
|
|
- 'Core block settings (if needed)',
|
|
|
+ 'Templates: Post templates - Single',
|
|
|
+ 'Templates: page.html',
|
|
|
+ 'Templates: Header template part',
|
|
|
+ 'Templates: Footer template part',
|
|
|
+ 'Block patterns',
|
|
|
+ 'Comment form styles (dotcom and dotorg)',
|
|
|
+ 'theme.json: Core block settings',
|
|
|
'Pre-launch: readme.txt',
|
|
|
'Pre-launch: screenshot.png',
|
|
|
'Pre-launch: style.css tags',
|
|
|
];
|
|
|
- issues.forEach( async ( issue ) => {
|
|
|
+ issues.forEach(async (issue) => {
|
|
|
try {
|
|
|
return await octokit
|
|
|
- .request( 'POST /repos/Automattic/themes/issues', {
|
|
|
+ .request('POST /repos/Automattic/themes/issues', {
|
|
|
title: theme + ': ' + issue,
|
|
|
- labels: [ '[Theme] ' + theme ],
|
|
|
+ labels: ['[Theme] ' + theme],
|
|
|
milestone: milestoneNumber,
|
|
|
- } )
|
|
|
- .then( ( issueData ) => {
|
|
|
- addIssueToProject( issueData );
|
|
|
- } );
|
|
|
- } catch ( error ) {
|
|
|
- console.log( error );
|
|
|
+ })
|
|
|
+ .then((issueData) => {
|
|
|
+ addIssueToProject(issueData);
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
}
|
|
|
- } );
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
-async function addIssueToProject( issueData ) {
|
|
|
+async function addIssueToProject(issueData) {
|
|
|
try {
|
|
|
- return await octokit.request( 'POST /projects/columns/11021541/cards', {
|
|
|
+ return await octokit.request('POST /projects/columns/11021541/cards', {
|
|
|
note: null,
|
|
|
content_id: issueData.data.id,
|
|
|
content_url: issueData.data.url,
|
|
|
content_type: 'Issue',
|
|
|
mediaType: {
|
|
|
- previews: [ 'inertia' ],
|
|
|
+ previews: ['inertia'],
|
|
|
},
|
|
|
- } );
|
|
|
- } catch ( error ) {
|
|
|
- console.log( error );
|
|
|
+ });
|
|
|
+ } catch (error) {
|
|
|
+ console.log(error);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-createLabel().then( () => {
|
|
|
- createMilestone().then( ( milestoneData ) => {
|
|
|
+createLabel().then(() => {
|
|
|
+ createMilestone().then((milestoneData) => {
|
|
|
const milestoneNumber = milestoneData.data.number;
|
|
|
- createIssues( milestoneNumber );
|
|
|
- } );
|
|
|
-} );
|
|
|
+ createIssues(milestoneNumber);
|
|
|
+ });
|
|
|
+});
|