This repository was archived by the owner on Dec 18, 2023. It is now read-only.
File tree 4 files changed +40
-1
lines changed
4 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,8 @@ const prompts = require('prompts')
4
4
const path = require ( 'path' )
5
5
const rimraf = require ( 'rimraf' )
6
6
7
+ const defaultMetadata = require ( '../helpers/defaultMetadata' )
8
+
7
9
const questions = [
8
10
{
9
11
type : 'text' ,
@@ -63,6 +65,7 @@ module.exports = () => {
63
65
const environments = require ( `${ pathForPlugin ( answers . name ) } /environments.json` )
64
66
environments . development . name = answers . name
65
67
environments . development . apiToken = answers . apiToken || ''
68
+ environments . development . metadata = defaultMetadata ( answers )
66
69
fs . writeFileSync (
67
70
`./livestorm-plugin-${ answers . name } /environments.json` ,
68
71
JSON . stringify ( environments , null , 2 )
@@ -71,7 +74,7 @@ module.exports = () => {
71
74
execSync ( `cd ${ pathForPlugin ( answers . name ) } && git init && git add --a && git commit -m "First commit"` )
72
75
73
76
console . log ( 'All done 🙌' )
74
- console . log ( `If you need to change any of the pre-given answers feel free to edit ./${ directoryNameFor ( answers . name ) } /package .json` )
77
+ console . log ( `If you need to change any of the pre-given answers feel free to edit ./${ directoryNameFor ( answers . name ) } /environments .json` )
75
78
console . log ( `You can start coding by opening ./${ directoryNameFor ( answers . name ) } /index.ts` )
76
79
console . log ( `Visit https://github.com/livestorm/livestorm-plugin for documentation` )
77
80
} catch ( err ) {
Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ const { execSync } = require('child_process')
9
9
const uploadFileOrDirectory = require ( '../helpers/uploadFileOrDirectory' )
10
10
const getLivestormPluginInformation = require ( '../helpers/getLivestormPluginInformation' )
11
11
const livestormDomain = require ( '../helpers/livestormDomain' )
12
+ const validateMetadata = require ( '../helpers/validateMetadata' )
12
13
13
14
const questions = [
14
15
{
@@ -76,6 +77,7 @@ module.exports = async function review() {
76
77
console . log ( 'Syncing plugin code...' )
77
78
execSync ( 'livestorm publish production' )
78
79
answers . metadata = config . metadata
80
+ validateMetadata ( config . metadata )
79
81
}
80
82
81
83
const zipUrl = await uploadZip ( createZip ( ) )
Original file line number Diff line number Diff line change
1
+
2
+ module . exports = function defaultMetadata ( answers ) {
3
+ return {
4
+ logo : "https://uploads-ssl.webflow.com/60ad0f9314e628baa6971a76/60ec0b72f45280483f7957cf_Icon-Livestorm-Primary.svg" ,
5
+ translations : {
6
+ title : {
7
+ en : answers . name . charAt ( 0 ) . toUpperCase ( ) + answers . name . slice ( 1 )
8
+ } ,
9
+ description : {
10
+ en : "This is your plugin description, you can change it by editing the metadata of your plugin's environment."
11
+ }
12
+ }
13
+ }
14
+ }
Original file line number Diff line number Diff line change
1
+
2
+ function validateMetadata ( json ) {
3
+ try {
4
+ if ( ! json ) throw 'Your environment is missing the "metadata" property.'
5
+ if ( ! json . logo ) throw 'No logo provided in the "metadata" property.'
6
+
7
+ if ( ! json . translations ) throw 'Your "metadata" must include a translations object to display your plugin in the marketplace.'
8
+ if ( ! json . translations . title ) throw 'You must provide a title in the translations object.'
9
+ if ( ! json . translations . title . en ) throw 'Your title does not contain english translations.'
10
+
11
+ if ( ! json . translations . description ) throw 'You must provide a translated description in the translations object.'
12
+ if ( ! json . translations . description . en ) throw 'Your description does not contain english translations.'
13
+ } catch ( err ) {
14
+ console . log ( err )
15
+ console . log ( 'Make sure your environment\'s "metadata" property follows the correct pattern: https://developers.livestorm.co/docs/review-marketplace#submit-your-plugin-to-the-marketplace' )
16
+ process . exit ( 1 )
17
+ }
18
+ }
19
+
20
+ module . exports = validateMetadata
You can’t perform that action at this time.
0 commit comments