How to use decentraland - 3 common examples

To help you get started, we’ve selected a few decentraland examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github decentraland / builder / src / modules / project / export.ts View on Github external
export function createDynamicFiles(args: { project: Project; scene: Scene; point: Coordinate; rotation: Rotation }) {
  const { project, scene, rotation, point } = args

  const files = {
    [EXPORT_PATH.MANIFEST_FILE]: JSON.stringify({
      version: MANIFEST_FILE_VERSION,
      project,
      scene
    }),
    [EXPORT_PATH.PACKAGE_FILE]: JSON.stringify(
      {
        ...packageJson,
        name: project.id,
        dependencies: {
          ...packageJson.devDependencies,
          'decentraland-builder-scripts': 'latest'
        }
      },
      null,
      2
    ),
    [EXPORT_PATH.SCENE_FILE]: JSON.stringify(getSceneDefinition(project, point, rotation), null, 2),
    [EXPORT_PATH.TSCONFIG_FILE]: JSON.stringify(
      {
        ...tsconfig,
        include: tsconfig.include.concat(['./node_modules/decentraland-builder-scripts/types.d.ts'])
      },
      null,
      2
    )
  }
github decentraland / builder / src / modules / project / export.ts View on Github external
export function getSceneDefinition(project: Project, point: Coordinate, rotation: Rotation) {
  const parcels = getParcelOrientation(project, point, rotation)
  const base = parcels.reduce((base, parcel) => (parcel.x <= base.x && parcel.y <= base.y ? parcel : base), parcels[0])

  return {
    ...sceneJson,
    scene: {
      ...sceneJson.scene,
      parcels: parcels.map(parcelToString),
      base: parcelToString(base)
    },
    source: {
      origin: 'builder',
      projectId: project.id
    }
  }
}
github decentraland / builder / src / modules / project / export.ts View on Github external
{
        ...packageJson,
        name: project.id,
        dependencies: {
          ...packageJson.devDependencies,
          'decentraland-builder-scripts': 'latest'
        }
      },
      null,
      2
    ),
    [EXPORT_PATH.SCENE_FILE]: JSON.stringify(getSceneDefinition(project, point, rotation), null, 2),
    [EXPORT_PATH.TSCONFIG_FILE]: JSON.stringify(
      {
        ...tsconfig,
        include: tsconfig.include.concat(['./node_modules/decentraland-builder-scripts/types.d.ts'])
      },
      null,
      2
    )
  }

  return files
}

decentraland

Decentraland CLI developer tool.

Apache-2.0
Latest version published 7 days ago

Package Health Score

78 / 100
Full package analysis